package com.pig.controller;

import com.pig.pojo.User;
import com.pig.service.UserService;
import com.pig.util.SysResultLayui;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class UserController {
    @Autowired
    private UserService userService;
    /**
     * 分页查询用户信息
     */

    @RequestMapping("/user/findUserByPage")
    public SysResultLayui<User> findItemByPage(int page, int limit,Integer count){
        return userService.findUserByPage(page,limit);

    }
    /**添加用户信息*/
    @RequestMapping("/user/save")
    public SysResultLayui<User> saveUser(User user){
        userService.saveUsername(user);
        return new SysResultLayui<>();
    }
    /**修改用户信息*/
    @RequestMapping("/user/update")
    public SysResultLayui<User> updateUser(User user){
        System.out.println(user);
        userService.updateUsers(user);
        return new SysResultLayui<>();
    }
}
